package cn.edu.tju.elm.model.wallet;

import cn.edu.tju.core.model.BaseEntity;
import jakarta.persistence.*;
import java.math.BigDecimal;

/**
 * 表示钱包的交易流水，记录每一笔资金变动的详细信息。
 * 字段说明：
 * id           - 交易流水唯一标识
 * createTime   - 交易发生时间
 * amount       - 交易金额
 * type         - 交易类型（如充值、提现、支付等）
 * toWalletId   - 入账钱包账号（资金流入方）
 * fromWalletId - 出账钱包账号（资金流出方）
 * status       - 交易状态（如成功、失败、处理中等）
 * fee          - 交易手续费
 * rewardAmount - 交易奖励金额
 * orderId      - 关联的订单ID
 * businessId   - 业务ID
 * remark       - 备注信息
 */

@Entity
@Table(name = "wallet_transaction")
public class WalletTransaction extends BaseEntity{
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    
    @Column(name = "amount", precision = 15, scale = 2)
    private BigDecimal amount;
    
    @Column(name = "type", nullable = false, length = 20)
    private String type;
    
    @Column(name = "to_wallet_id")
    private Long toWalletId;
    
    @Column(name = "from_wallet_id")
    private Long fromWalletId;
    
    @Column(name = "status", nullable = false, length = 20)
    private String status;
    
    @Column(name = "fee", precision = 15, scale = 2)
    private BigDecimal fee;

    @Column(name = "reward_amount", precision = 15, scale = 2)
    private BigDecimal rewardAmount;
    
    @Column(name = "order_id")
    private Long orderId;
    
    @Column(name = "business_id")
    private Long businessId;
    
    @Column(name = "remark", length = 500)
    private String remark;

    @Column(name = "transaction_no", unique = true, length = 32)
    private String transactionNo;
    
    // Getters and Setters
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public BigDecimal getAmount() {
		return amount;
	}

	public void setAmount(BigDecimal amount) {
		this.amount = amount;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public Long getToWalletId() {
		return toWalletId;
	}

	public void setToWalletId(Long toWalletId) {
		this.toWalletId = toWalletId;
	}

	public Long getFromWalletId() {
		return fromWalletId;
	}

	public void setFromWalletId(Long fromWalletId) {
		this.fromWalletId = fromWalletId;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public BigDecimal getFee() {
		return fee;
	}

	public void setFee(BigDecimal fee) {
		this.fee = fee;
	}

	public BigDecimal getRewardAmount() {
		return rewardAmount;
	}

	public void setRewardAmount(BigDecimal rewardAmount) {
		this.rewardAmount = rewardAmount;
	}

	public Long getOrderId() {
		return orderId;
	}

	public void setOrderId(Long orderId) {
		this.orderId = orderId;
	}

	public Long getBusinessId() {
		return businessId;
	}

	public void setBusinessId(Long businessId) {
		this.businessId = businessId;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getTransactionNo() {
		return transactionNo;
	}

	public void setTransactionNo(String transactionNo) {
		this.transactionNo = transactionNo;
	}
}